package com.supplychainapi.service;

import com.github.pagehelper.PageInfo;
import com.joindata.inf.common.basic.exceptions.ServiceException;
import com.supplychainapi.domain.IncrementRate;
import com.supplychainapi.model.ScmTbsupplier;
import com.supplychainapi.model.ScmTbsupplierExtend;
import com.supplychainapi.param.ColTitle;

import java.util.List;
import java.util.Map;

/**
 *
 * 供应商
 * @author:xiezhiwei
 * @email:xiezhiwei@niwodai.net
 * @date:2017-09-26
 *
 */
public interface IScmTbsupplierService {

	/**
	 * 新增供应商信息
	 * @param supplier
	 * @throws ServiceException
	 */
	void addScmTbsupplierInfo(ScmTbsupplier supplier) throws ServiceException;

	/**
	 * 更新供应商信息
	 * @param supplier
	 * @throws ServiceException
	 */
	void updateScmTbsupplierInfo(ScmTbsupplier supplier) throws ServiceException;

	/**
	 * 更新供应商查询供应商信息
	 * @param fsSupplierName
	 * @return
	 * @throws ServiceException
	 */
	ScmTbsupplier getSupplierByFsSupplierNameInfo(String fsSupplierName) throws ServiceException;

	/**
	 * 根据供应商供应商代码获取供应商信息
	 * @param fsSupplierId
	 * @return
	 */
	ScmTbsupplier getSupplierInfo(String fsSupplierId);

	/**
	 * 查询供应商信息(下一级的代码名称会拼上上一层代码名称)
	 * @param fsNodeFullText
	 * @param page
	 * @param pageSize
	 * @return
	 */
	List<ScmTbsupplier> getSupplierByfsNodeFullTextList(String fsShopGUID, String fsNodeFullText, Integer page, Integer pageSize) throws ServiceException;


	/**
	 * 根据店铺GUID和供应商ID查询供应商信息
	 * @param fsShopGUID
	 *  @param fsSupplierId
	 * @return
	 */
	ScmTbsupplier getSupplierByFsShopGUIDList(String fsShopGUID, String fsSupplierId) throws ServiceException;


	/**
	 * 根据店铺GUID和供应商ID查询供应商详情
	 * @param fsShopGUID
	 *  @param fsSupplierId
	 * @return
	 */
	ScmTbsupplier getSupplierDetails(String fsShopGUID, String fsSupplierId) throws ServiceException;

	/**
	 * 删除供应商信息
	 * @param fsSupplierId
	 * @param fsShopGUID
	 * @throws ServiceException
	 */
	void deleteSupplierInfo(List<String> fsSupplierIdList, List<String> fsShopGUIDList) throws ServiceException;


	/**
	 * 根据 供应商代码 供应商名称 助记码 进行查询
	 * @param fsSupplierId 供应商代码
	 * @param fsSupplierName 供应商名称
	 * @param fsHelpCode 助记码
	 * @param page 分页码
	 * @param pageSize 条数
	 * @return
	 * @throws ServiceException
	 */
	List<ScmTbsupplier> getByKeyWordSupplierInfoList(String keyWord, Integer page, Integer pageSize) throws ServiceException;

	/**
	 * 根据门店ID查询供应商全部信息
	 * @param fsShopGUID
	 * @param page
	 * @param pageSize
	 * @return
	 */
	List<ScmTbsupplierExtend> getSupplierAllListInfo(String fsShopGUID, Integer page, Integer pageSize) throws ServiceException;

	/**
	 * 根据店铺GUID和供应商ID查询供应商信息
	 * @param fsShopGUID
	 * @param fsSupplierId
	 * @return
	 */
	Boolean getSupplierNameIsExit(String fsShopGUID, String fsSupplierName, String fsSupplierId, String type) throws ServiceException;


	/**
	 * 统计供应商数量
	 * @param param
	 * @return
	 */
	int count(ScmTbsupplier param);

	/**
	 * 标题
	 * @return
	 */
	List<ColTitle> getSchema();

	/**
	 * 查询供应商列表
	 * @param fsShopGUID
	 * @param keyWord
	 * @param fsNodeCode
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	PageInfo getSupplierListInfo(String fsShopGUID, String keyWord, String fsNodeCode, Integer pageNum,
								 Integer pageSize) throws ServiceException;

	/**
	 * 选取供应商列表
	 * @param fsShopGUID
	 * @param keyWord
	 * @param fsNodeCode
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	PageInfo getChoiceSupplierListInfo(String fsShopGUID, String keyWord,
									   String fsNodeCode, Integer pageNum, Integer pageSize) throws ServiceException;


	/**
	 * 查询供应商列表
	 * @param fsShopGUID
	 * @param keyWord
	 * @param fsNodeCode
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	/*public List<ScmTbsupplier> getSupplierListInfo(String fsShopGUID, String keyWord, String fsNodeCode, Integer pageNum,
			Integer pageSize) throws ServiceException;
	*/

	/**
	 * 选取供应商列表
	 * @param fsShopGUID
	 * @param keyWord
	 * @param fsNodeCode
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	/*public List<ScmTbsupplier> getChoiceSupplierListInfo(String fsShopGUID, String keyWord, String fsNodeCode,
			Integer pageNum, Integer pageSize);
	*/

	/**
	 * 增值税率
	 *
	 * @return
	 */
	Map<String, List<IncrementRate>> getIncrementRate();

	/**
	 * 供应商详情、分类全名名称、等级名称
	 *
	 * @param fsShopGUID
	 * @param fsSupplierId
	 * @return
	 */
	ScmTbsupplierExtend getSupplierDetailsInfo(String fsShopGUID, String fsSupplierId);


	/**
	 * 新增供应商信息
	 *
	 * @param supplier
	 * @throws ServiceException
	 */
	void addScmTbsupplierPhoneInfo(ScmTbsupplier supplier) throws ServiceException;


	/**
	 * 更新供应商信息
	 *
	 * @param supplier
	 * @throws ServiceException
	 */
	void updateScmTbsupplierPhoneInfo(ScmTbsupplier supplier) throws ServiceException;


	/**
	 * 删除供应商信息
	 *
	 * @param fsSupplierId
	 * @param fsShopGUID
	 * @throws ServiceException
	 */
	void deletePhoneSupplierInfo(List<String> fsSupplierIdList, List<String> fsShopGUIDList) throws ServiceException;

	/**
	 * 根据供应商分类ID获取供应商列表信息
	 *
	 * @param fsNodeCode
	 * @param page
	 * @param pageSize
	 * @return
	 * @throws ServiceException
	 */
	List<ScmTbsupplier> getSupplierPhoneListInfo(String fsShopGUID, String fsNodeCode, Integer page, Integer pageSize) throws ServiceException;

	/**
	 * 根据供应商名称模糊查询供应商信息
	 *
	 * @param fsShopGUID
	 * @param fsSupplierName
	 * @param page
	 * @param pageSize
	 * @return
	 * @throws ServiceException
	 */
	List<ScmTbsupplierExtend> getSupplierPhoneByFsSupplierNameListInfo(String fsShopGUID, String fsSupplierName, Integer page, Integer pageSize) throws ServiceException;

	/**
	 * 根据供应商、门店ID查询供应商信息
	 *
	 * @param fsShopGUID
	 * @param fsSupplierId
	 * @return
	 */
	ScmTbsupplierExtend getSupplierPhoneDetailsInfo(String fsShopGUID, String fsSupplierId) throws ServiceException;

	/**
	 * 根据门店ID查询供应商全部信息
	 *
	 * @param fsShopGUID
	 * @param page
	 * @param pageSize
	 * @return
	 */
	List<ScmTbsupplierExtend> getSupplierAllPhoneListInfo(String fsShopGUID, Integer page, Integer pageSize) throws ServiceException;


	List<ScmTbsupplierExtend> getSupplierParentAllPhoneListInfo(String fsShopGUID, String fsNodeCode, Integer page,
																Integer pageSize) throws ServiceException;


    /**
     * 总部供进货应商
     *
     * @param fsShopGUID
     * @return
     * @throws ServiceException
     */
    List<ScmTbsupplier> getHeadquartersSupplierInfo(String fsShopGUID) throws ServiceException;

    int updateFullText(ScmTbsupplier supplier);


    List<ScmTbsupplier> findFullCode(String fsShopGuid, String fullCode) throws ServiceException;

    /**
     * 根据关键字模糊查询供应商信息
     *
     * @param fsShopGUID
     * @param fsSupplierName
     * @param page
     * @param pageSize
     * @return
     * @throws ServiceException
     */
    List<ScmTbsupplierExtend> getSupplierKeyWordListInfo(String fsShopGUID, String keyWords, Integer page,
                                                         Integer pageSize) throws ServiceException;
}
